www.WroxConferences.com
Click Here!
Home > Active Server Pages : Code
asp superexpert
The community of Active Server Pages experts
preferences | bookmarks | help
 messages     tutorials     answers     links     articles     jobs     books     software     code     reference     workshops   
WhosOn Page 2.0
The WhosOn Page displays the current visitors to your Website. It displays the page the visitor last requested and the visitor's IP address.

The WhosOn page appeared in both Active Server Pages Unleashed and Active Server Pages 2.0 Unleashed. Sadly, there were problems with the script in both editions of the book.

In Active Server Pages Unleashed (the original edition), the WhosOn page used a Scripting Dictionary object stored in an Application variable to track users. This turned out to be a bad mistake. Since the Dictionary object is Apartment threaded, the WhosOn page would cause errors at sites with heavy traffic (Microsoft had incorrectly marked the Dictionary object as Both Threaded in the registry).

In Active Server Pages 2.0 Unleashed, I rewrote the WhosOn page so that it used an Application array rather than the Dictionary object. So far, so good. However, there is a mistake in the code that appears in the book. The Application array is incorrectly declared in the Global.asa file.

In the listings below, you will find the (current) final version of the WhosOn page. However, be warned, this script has caused me nothing but trouble and unhappiness! Use the script with caution.

To use the WhosOn page, make the modifications to your Global.asa file indicated in Listing 1.0. Next, the WhosOn.asp page in Listing 2.0 displays all of the users currently being tracked. Finally, create the GrabStats.asp file contained in Listing 3.0. You will need to include this file at the top of every page at your Web site that you want to track.

Listing 1.0 - Global.asa

Listing 2.0 - WhosOn.asp

Listing 3.0 - grabStats.asp

 
Comments

Add Your Comment
Update Code

copyright © 2000 by superexpert. All rights reserved Advertising Information
Click Here!

 

superexpert news!
Get the latest Active Server Pages news! Enter your email address to receive superexpert's weekly newsletter.
 
Click Here!
Click Here!